{extend name='common/_container'}
{block name="content"}
<div class="ibox float-e-margins">
<input type="hidden" name='class_id' id='class_id' value="{$info.class_id}" />
	<div class="ibox-content">
		<div class="form-horizontal" id="CodeInfoForm">
			<div class="row">
				<div class="col-sm-12">
				<!-- form start -->
					<div class="form-group">
						<label class="col-sm-2 control-label">分类图片：</label>
						<div class="col-sm-6">
							<input type="text" autocomplete="off" id="img" value="{$info.img}" {if condition="config('my.img_show_status') eq true"}onmousemove="showBigPic(this.value)" onmouseout="closeimg()"{/if} name="img" class="form-control" placeholder="请输入分类图片">
							<span class="help-block m-b-none img_process"></span>
						</div>
						<div class="col-sm-2" style="position:relative; right:30px;">
							<span id="img_upload"></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">副图片：</label>
						<div class="col-sm-6">
							<input type="text" autocomplete="off" id="imgs" value="{$info.imgs}" {if condition="config('my.img_show_status') eq true"}onmousemove="showBigPic(this.value)" onmouseout="closeimg()"{/if} name="imgs" class="form-control" placeholder="请输入副图片">
							<span class="help-block m-b-none imgs_process"></span>
						</div>
						<div class="col-sm-2" style="position:relative; right:30px;">
							<span id="imgs_upload"></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">分类名称：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="title" value="{$info.title}" name="title" class="form-control" placeholder="请输入分类名称">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">链接地址：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="url" value="{$info.url}" name="url" class="form-control" placeholder="请输入链接地址">
						</div>
					</div>
				<!-- form end -->
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			<div class="row btn-group-m-t">
				<div class="col-sm-9 col-sm-offset-1">
					<button type="button" class="btn btn-primary" onclick="CodeInfoDlg.edit()" id="ensure">
						<i class="fa fa-check"></i>&nbsp;确认提交
					</button>
					<button type="button" class="btn btn-danger" onclick="CodeInfoDlg.close()" id="cancel">
						<i class="fa fa-eraser"></i>&nbsp;取消
					</button>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/plugins/layui/layui.js" charset="utf-8"></script>
<script>
layui.use(['form'],function(){});
uploader('img_upload','img','image',false,'','{:getUploadServerUrl()}');
uploader('imgs_upload','imgs','image',false,'','{:getUploadServerUrl()}');
var CodeInfoDlg = {
	CodeInfoData: {},
	validateFields: {
		title: {
			validators: {
				notEmpty: {
					message: '分类名称不能为空'
	 			},
	 		}
	 	},
	 }
}

CodeInfoDlg.collectData = function () {
	this.set('class_id').set('img').set('imgs').set('title').set('url');
};

CodeInfoDlg.edit = function () {
	 this.clearData();
	 this.collectData();
	 if (!this.validate()) {
	 	return;
	 }
	 var ajax = new $ax(Feng.ctxPath + "/Test.Classify/edit", function (data) {
	 	if ('00' === data.status) {
	 		Feng.success(data.msg,1000);
	 		window.parent.CodeGoods.table.refresh();
	 		CodeInfoDlg.close();
	 	} else {
	 		Feng.error(data.msg + "！",1000);
		 }
	 })
	 ajax.set(this.CodeInfoData);
	 ajax.start();
};


</script>
<script src="__PUBLIC__/static/js/base.js" charset="utf-8"></script>
{/block}
